﻿namespace S7_3UBD
{
    /// <summary>
    /// 用户业务逻辑处理层类
    /// </summary>
    public class UserService
    {
        public List<Base_User> GetList()
        {
            UserDBAccess access = new UserDBAccess();
            var list = access.GetList();
            //逻辑处理代码

            return list;
        }

        public void Add()
        {
            UserDBAccess access = new UserDBAccess();
            LogDBAccess logDBAccess = new LogDBAccess();
            access.Add(new Base_User
            {
                Name = "猪八戒",
                Age = 1000,
                Gender = 1
            }, context =>
            {
                logDBAccess.Add(new Base_Log
                {
                    Message = "创建一个用户：猪八戒"
                },context);
            });


        }
    }
}
